<?php

namespace App\Http\Service;

use App\Http\Repository\PointLogRepository;
use App\Http\Criteria\OrderByCreatedAtCriteria;
use App\Http\Criteria\PaginateCriteria;
use App\Http\Criteria\UserIDCriteria;

class PointLogService extends BaseService
{
    protected $rep;

    public function __construct(PointLogRepository $repository)
    {
        $this->rep = $repository;
    }

    public function log($user, $page)
    {
        $this->rep->pushCriteria(new OrderByCreatedAtCriteria());
        $this->rep->pushCriteria(new PaginateCriteria($page, 20));
        $this->rep->pushCriteria(new UserIDCriteria($user->id));

        return $this->rep->get();
    }

}
